package com.ugoodtech.mdcc.core.repository;

import com.ugoodtech.mdcc.core.domain.ComplaintReportData;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface ComplaintReportDataRepository extends PagingAndSortingRepository<ComplaintReportData, Long>
        , QueryDslPredicateExecutor<ComplaintReportData> {

    @Query("from ComplaintReportData where complaint_report_id=:report_id and deleted=false and enabled = true")
    List<ComplaintReportData> selectAnswer(@Param("report_id") Long report_id);

    @Query("from ComplaintReportData where complaint_report_id=:report_id and question_id=:questionId and deleted=false and enabled = true")
    ComplaintReportData selectByQuestion(@Param("report_id") Long report_id, @Param("questionId") Long questionId);

}
